/*
 ******************************
 * Object Oriented Programming in C
 *
 * Author: Laurent Deniau, Laurent.Deniau@cern.ch
 *
 * For more information, please see the paper:
 * http://home.cern.ch/ldeniau/html/oopc/oopc.html
 *
 ******************************
 */

#include <stdio.h>

/*------------------------------*/
/*   education implementation   */
/*------------------------------*/

#define IMPLEMENTATION

#include <education.h>

/*
  ---------------------
  Object implementation
  ---------------------
*/

void
constMethodDecl(print)
{
  printf("\tdipl:\t%s\n", this->m.diploma);
}

BASEOBJECT_IMPLEMENTATION

  methodName(print)

ENDOF_IMPLEMENTATION

/*
  --------------------
  Class implementation
  --------------------
*/

initClassDecl() {} /* required */

dtorDecl() /* required */
{
  free((void*)this->m.diploma);
  this->m.diploma = NULL;
}

void
methodDecl_(init) char const diploma[] __
{
  this->m.diploma = strdup(diploma);
}

void
methodDecl_(copy) t_education const*const edu __
{
  education._education(this);
  education.init(this, edu->m.diploma);
}

ABSTRACTCLASS_IMPLEMENTATION

  methodName(init),
  methodName(copy)

ENDOF_IMPLEMENTATION
